<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<title>购买外币计算器</title>
<link href="base.css" rel="stylesheet" type="text/css">
<link href="tool.css" rel="stylesheet" type="text/css">
<link href="art.default.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript" src="rate.js"></script>
<script type="text/javascript" src="artDialog.basic.js"></script>
<script type="text/javascript">
//对应汇率  m=1银行卖出  m=2现汇  m=3现钞

//汇率选择
function selFx(e){

	  var exRateVal = 0;
	  
      switch( e.value){

          case "GBP":
        	  exRateVal = forex0[3];
			  break;
          case "HKD":
          	  exRateVal = forex1[3];
          	  break;
          case "USD":
			  exRateVal = forex2[3];
			  break;
          case "CHF":
          	  exRateVal = forex3[3];
          	  break;
          case "SGD":
              exRateVal = forex4[3];
         	  break;
          case "SEK":
              exRateVal = forex5[3];
              break;
          case "DKK":
              exRateVal = forex6[3];
              break;
          case "NOK":
              exRateVal = forex7[3];
         	  break;
          case "JPY":
              exRateVal = forex8[3];
              break;
          case "CAD":
              exRateVal = forex9[3];
              break;
          case "AUD":
              exRateVal = forex10[3];
              break;
          case "EUR":
              exRateVal = forex11[3];
              break;
          case "MOP":
              exRateVal = forex12[3];
              break;
          case "PHP":
              exRateVal = forex13[3];
              break;
          case "THB":
              exRateVal = forex14[3];
              break;
          case "NZD":
             exRateVal = forex15[3];
             break;
          case "KRW":
             exRateVal = forex16[3];
             break;
          case "RUB":
             exRateVal = forex17[3];
             break;
      }
	  
	  $id("exRate").value = exRateVal;

}

//计算
function bugf(){
	
	var buyAmt = $id("buyAmt");
	var exRate = $id("exRate");

    if (!checkFormPlus(buyAmt, "买入外币总额")){return false};
	
	if (!checkFormPlus(exRate, "当前汇率")){return false};

    var A = parseFloat( buyAmt.value),

    R = parseFloat(exRate.value)

    $id("pay").value=( A * R / 100 ).format(2);

}

window.onload = function(){
	selFx($id("fxType"));	
}

function bugrset(formObj){
    formObj.reset();
    $id("exRate").value = forex2[3];
}




</script>
</head>
<body>
<div class="container" id="container">
  <form action="" method="post" onSubmit="return false;">
  <div class="title">
    <h2>购买外币计算器</h2>
    <div class="bg"></div>
  </div>
  <div class="content">
      
      <div class="warm_tip">
      	<p>本计算器适用于估算个人购汇所需支出的人民币<br/>
           <span class="red">当前汇率为银行的"卖出价"</span>
        </p>
      </div>
      
      <ul class="form_items">
        <li>
          <label>买入外币总额:</label>
          <span>
          <input value="" type="text" id="buyAmt" name="buyAmt">
          </span> </li>
        <li>
          <label>外币类型:</label>
          <span>
          <select id="fxType" name="fxType" onchange="selFx(this);">
            <option value="GBP">英镑 (GBP)</option>
            <option value="HKD">港币 (HKD)</option>
            <option value="USD" selected="true">美元 (USD)</option>
            <option value="CHF">瑞士法郎 (CHF)</option>
            <option value="SGD">新加坡元 (SGD)</option>
            <option value="SEK">瑞典克朗 (SEK)</option>
            <option value="DKK">丹麦克朗 (DKK)</option>
            <option value="NOK">挪威克朗 (NOK)</option>
            <option value="JPY">日元 (JPY)</option>
            <option value="CAD">加拿大元 (CAD)</option>
            <option value="AUD">澳大利亚元 (AUD)</option>
            <option value="EUR">欧元 (EUR)</option>
            <option value="MOP">澳门元 (MOP)</option>
            <option value="PHP">菲律宾比索 (PHP)</option>
            <option value="THB">泰国铢 (THB)</option>
            <option value="NZD">新西兰元 (NZD)</option>
            <option value="KRW">韩国元 (KRW)</option>
            <option value="RUB">卢布 (RUB)</option>
          </select>
          </span> </li>
        <li>
          <label>当前汇率:</label>
          <span>
          <input value="" type="text"  id="exRate" name="exRate">
          </span> </li>
      </ul>
      <div class="button_bar">
        <input type="button" onClick="bugf();" value="开始计算" class="submit" />
        <input type="button" id="hqResetBtn" class="reset" value="重新计算" onClick="bugrset(this.form)"/>
      </div>
    
  </div>
  <div class="title">
    <h2>计算结果</h2>
    <div class="bg"></div>
  </div>
  <div class="content">
    <ul class="form_items">
      <li>
        <label>需支出人民币：</label>
        <span>
        <input type="text" value="" id="pay" name="pay" readonly="readonly" disabled="true" role="disabled"/>
        </span> </li>
    </ul>
  </div>
  </form>
</div>
</body>
</html>
